<?php

namespace INT\UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    
    public function listEtudientAction(){
        $em=  $this->getDoctrine()->getEntityManager();
        $repository=$em->getRepository('INTUserBundle:User');
        $etudients=$repository->findBy(array('grad_ens'=>null));
        return $this->render('INTUserBundle:Default:listEtudient.html.twig', array('etudients' => $etudients));
    }
    public function deleteUserAction(){
        $em=  $this->getDoctrine()->getEntityManager();
        $repository=$em->getRepository('INTUserBundle:User');
        $id=  $this->getRequest()->get('id');
        $user=$repository->find($id);
        $em->remove($user);
        $em->flush();
         $etudients=$repository->findAll();
        return $this->render('INTUserBundle:Default:list_etudients.html.twig', array('etudients' => $etudients));
    
    }

}
